package com.wanxi.hashset;

import java.util.HashSet;
import java.util.Set;

public class StudentTest {
    public static void main(String[] args) {
        Set<Student> set = new HashSet<>();
        set.add(new Student("zhangsan", 11));
        set.add(new Student("lisi", 13));
        set.add(new Student("wangwu", 17));
        Student s1 = new Student("lucy", 14);
        Student s2 = new Student("lucy", 14);
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        set.add(s1);
        set.add(s2);
        set.add(new Student("xiaoming", 12));
        for (Student s:set
             ) {
            System.out.println(s);
        }
    }
}
